package com.qf.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/show/req")
public class Demo1Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取数据
        String username = req.getParameter("username");
        System.out.println("username = " + username);
        String password = req.getParameter("password");
        System.out.println("password = " + password);
        String sex = req.getParameter("sex");
        int sexnum=Integer.parseInt(sex);
        System.out.println("sex = " + (sexnum==1?"男":"女"));

        String email = req.getParameter("email");
        System.out.println("email = " + email);
        String birthday = req.getParameter("birthday");
        System.out.println("birthday = " + birthday);
        String edu = req.getParameter("edu");
        System.out.println("edu = " + edu);
        String beizhu = req.getParameter("beizhu");
        System.out.println("beizhu = " + beizhu);
        String[] skills = req.getParameterValues("skill");

        //
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter writer = resp.getWriter();
        writer.write("<html>");
    }
}
